<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
<title>设置覆盖物的显示与隐藏</title>
</head>
<body>
<div id="l-map"></div>
<div id="r-result">
    <input type="button" onclick="marker.enableDragging();" value="可拖拽" />
    <input type="button" onclick="marker.disableDragging();" value="不可拖拽" />
</div>
</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("l-map");
var point = new BMap.Point(120.400131,36.104156);
map.centerAndZoom(point, 12);
var marker = new BMap.Marker(point);  // 创建标注
map.addOverlay(marker);              // 将标注添加到地图中
marker.enableDragging();    //可拖拽
marker.addEventListener("dragend", function(e){
alert("当前位置：" + e.point.lng + ", " + e.point.lat);  
});

</script>
